#ifndef QTRENDERSETTINGS_H
#define QTRENDERSETTINGS_H

#include <QVector>
#include <QRect>
#include "nonqtmain.h"
//
//typedef struct BarData
//{
//	int index;
//	double open;
//	double close;
//	double high;
//	double low;
//}BarData;


typedef struct ZoomSeetings
{
	double distance;;
	double barwidth;
}ZoomSeetings;

typedef enum {zoomin = 1, zoomout} zoomset;




//class used to record business coordinate(another kind of coordinate is geography cooridinte)
class BusiCoord
{

public:

	BusiCoord(QRect& rect, BarSeries* pBarSer, BarData* pData);

	~BusiCoord();

	
	bool BusiCoordIndex(int& minXIndex, int& maxXIndex);

	bool SetScroll(int dx);


	bool SetZoom(zoomset option);

	ZoomSeetings* GetZoom(){ return (m_zoomset + m_zoomindex);};


	void SetBusiRect(QRect& rect);

	QRect* GetBusiRect(){return m_pBusiRect;};



	bool SetBarData(BarData* pData);

	bool GetBarData(int index, BarData* &pData);


	bool IsValidCurosr(QPoint& point);

	int GetCursorIndex();


	void SetCursorORUncursor(bool value);

private:

	void SetBusiCoordIndex(int paraMaxIndex);

	bool SetBusiCoordIndexCore(int paraMaxIndex);

	void resizeORzoom();

	
	void SetCursorIndex(QPoint& point);


public:

	//rect
	enum { LeftMargin = 50, RightMargin = 50, MarginBarnum = 2 };

private:
	bool m_bValid;


	BarSeries* m_pBarSer;

	////Bars
	BarData* m_pData;



	//index of display Bars in m_pDatas
	int m_minXIndex;
	int m_maxXIndex;


	//rect
	QRect* m_pBusiRect;


	//zoom
	ZoomSeetings* m_zoomset;
	int m_zoomsize;
	int m_zoomindex;


	//cursorIndex
	int m_cursorIndex;

	bool m_bcursorstate;

};


#endif